package com.weiweiqin.service.impl;

import java.util.List;
import java.util.Map;

import com.weiweiqin.dao.GoodsCategoryItemDao;
import com.weiweiqin.dao.GoodsDao;
import com.weiweiqin.dao.GoodsPicItemDao;
import com.weiweiqin.dao.PicDao;
import com.weiweiqin.model.Goods;
import com.weiweiqin.model.GoodsCategoryItem;
import com.weiweiqin.model.Pic;
import com.weiweiqin.service.CategoryService;
import com.weiweiqin.service.GoodsService;
import com.weiweiqin.vo.common.Page;

public class GoodsServiceImpl implements GoodsService {

	private GoodsDao goodsDao;
	
	private PicDao picDao;
	
	private GoodsCategoryItemDao goodsCategoryItemDao;
	
	private CategoryService categoryService;
	
	public GoodsCategoryItemDao getGoodsCategoryItemDao() {
		return goodsCategoryItemDao;
	}

	public void setGoodsCategoryItemDao(GoodsCategoryItemDao goodsCategoryItemDao) {
		this.goodsCategoryItemDao = goodsCategoryItemDao;
	}

	public GoodsPicItemDao getGoodsPicItemDao() {
		return goodsPicItemDao;
	}

	public void setGoodsPicItemDao(GoodsPicItemDao goodsPicItemDao) {
		this.goodsPicItemDao = goodsPicItemDao;
	}

	private GoodsPicItemDao goodsPicItemDao;

	public GoodsDao getGoodsDao() {
		return goodsDao;
	}

	public void setGoodsDao(GoodsDao goodsDao) {
		this.goodsDao = goodsDao;
	}

	public void update(Goods goods) {
		goodsDao.update(goods);
		
	}

	public List<Goods> pageList(Page page, Map<String, Object> conditions) {
		return goodsDao.pageList(page, conditions);
	}

	public int totalCount() {
		return goodsDao.totalCount();
	}

	public void save(Goods goods) {
		goodsDao.insert(goods);
		
	}

	public Goods get(int id) {
	
		return goodsDao.get(id);
	}

	public List<Goods> getListByCategoryId(int categoryId) {
		return goodsDao.getListByCategoryId(categoryId);
	}

	public PicDao getPicDao() {
		return picDao;
	}

	public void setPicDao(PicDao picDao) {
		this.picDao = picDao;
	}

	public CategoryService getCategoryService() {
		return categoryService;
	}

	public void setCategoryService(CategoryService categoryService) {
		this.categoryService = categoryService;
	}
	
	public void savePic(Pic pic){
		picDao.insert(pic);
	}

	public void saveGoodsCategoryItem(GoodsCategoryItem goodsCategoryItem) {
		goodsCategoryItemDao.insert(goodsCategoryItem);
		
	}

	public void del(int id) {
		goodsDao.delete(id);
	}

}